﻿<%@ include file="../include/top.jsp"%>
<%@ include file="../include/errorArea.jsp" %>
<link rel="stylesheet" href="${baseURL}/css/zTreeStyle/zTreeStyle.css" type="text/css">
<script language="javascript" type="text/javascript" src="${baseURL}/js/jquery.ztree.all-3.5.min.js">
</script>
<SCRIPT type="text/javascript">
	var setting = {
		view: {
			dblClickExpand: false
		},
		data: {
			simpleData: {
				enable: true
			}
		},
		callback: {
			onClick: onClick
		}
	};

	var zNodes = ${treedata}; //后台返回的数据

	function onClick(e,treeId, treeNode) {
		var zTree = $.fn.zTree.getZTreeObj("treeDemo");
		zTree.expandNode(treeNode);

		//叶节点，并且不是第一层节点(第一层节点的pId是null)
		//if(!treeNode.isParent && treeNode.pId!=null){
			nodes = zTree.getSelectedNodes();
			$("#selectedNodeName").attr("value", treeNode.name);
			$("#nodeId").attr("value", treeNode.id);
		//}
	}

	function showMenu() {
		var cityObj = $("#selectedNodeName");
		var cityOffset = $("#selectedNodeName").offset();
		$("#menuContent").css({left:cityOffset.left + "px", top:cityOffset.top + cityObj.outerHeight() + "px"}).slideDown("fast");

		$("body").bind("mousedown", onBodyDown);
	}
	function hideMenu() {
		$("#menuContent").fadeOut("fast");
		$("body").unbind("mousedown", onBodyDown);
	}
	function onBodyDown(event) {
		if (!(event.target.id == "menuBtn" || event.target.id == "selectedNodeName" || event.target.id == "menuContent" || $(event.target).parents("#menuContent").length>0)) {
			hideMenu();
		}
	}

	$(document).ready(function(){
		$.fn.zTree.init($("#treeDemo"), setting, zNodes);
		
		var treeObj = $.fn.zTree.getZTreeObj("treeDemo");
		var nodes = treeObj.getNodesByParam("id", "${formdata.nodeId}", null);
		if (nodes.length>0) {
			treeObj.selectNode(nodes[0]);
		}

	});
</SCRIPT>

<script>
$("#supplierId").val("${formdata.supplierId}");

function clearInput() {
	document.getElementById("passStatus").options[0].selected=true;
	document.getElementById("id").value = "";
	document.getElementById("keyword").value = "";
	document.getElementById("nodeId").value = "";
	document.getElementById("selectedNodeName").value = "";
	document.getElementById("supplierId").options[0].selected=true;
}

function selectAll(checkAllFlag) {
	var checkArray = document.getElementsByName("chk");
	for (var i = 0; i < checkArray.length; i++) {
		checkArray[i].checked = checkAllFlag;
	}
}
</script>
<c:if test="${empty obj.odList}">
<div align="center"><b>没有符合条件的记录。</b></div>
</c:if>
<c:if test="${not empty obj.odList}">
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1" id="listOutTable">
  <tr>
    <td colspan="2" align="left" valign="middle" class="text_gray2"><table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#96bee2">
      <tr>
        <td height="21" background="${baseURL}/images/table_bg.jpg">&nbsp;&nbsp;
        <span class="text_blue_b">
        <img src="${baseURL}/images/008.png" width="16" height="16" align="absmiddle" />&nbsp;商品列表：</span></td>
      </tr>
      <tr>
        <td height="13" valign="top" bgcolor="#FFFFFF">
        <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF" id="listTable">
	<tr align="center" bgcolor="#eeeeee">
		<td width="5%">商品编号</td>
		<td width="35%">商品名称</td>
		<td width="10%">商品图片</td>
		<td width="8%">销售价</td>
		<td width="8%">购买数量</td>
		<td>操作</td>
	</tr>
	<c:forEach var="oneRow" items="${obj.odList}">
		<tr align="center">
			<td>${oneRow.id}</td>
			<td>${oneRow.productName}</td>
			<td><img src="http://localhost/${oneRow.productPic1}" height="30" width="30"/></td>
			<td align="right">${oneRow.sellPrice}</td>
			<td>${oneRow.buyNum}</td>
			<td>
			<a href="#" onclick="delById('${ctx}',${oneRow.buyId})">[删除]</a>
			</td>
		</tr>
	</c:forEach>
        </table>
        </td>
      </tr>
    </table></td>
  </tr>
  <tr>
   <td height="5">
    <input name="button" type="button" onclick="delByIds('${ctx}');" value="批量删除" class="myButton" />
</td> 
    <td height="1" align="right">合计:${sum}元</td>
  </tr>
 <tr><td></td></tr>
   <tr>
   <td>
    	楼号：<input name="buildNo" id="buildNo" type="text" value=""/>单元号：<input name="unitNo" id="unitNo" type="text" value=""/>门牌号：<input name="roomNo" id="roomNo" type="text" value=""/>会员：<select name="realName" id="realName" style="width:100px" onfocus="checkUser('${ctx}');"></select>会员卡号：<label id="cardNo" ></label>
   <input type="hidden" id="userNo" value="" name="userNo" />
   </td>
   
  </tr>
 <tr><td></td></tr>
  <tr>
  <td>
    	配送方式：<input name="send" type="radio" value="1"/>物业自提<input name="send" type="radio" value="2"/>送货上门（派送费：2元）
   </td>
   <td>
    	支付方式：<input name="pay" type="radio" value="1"/>现金<input name="pay" type="radio" value="2"/>会员卡
   </td>
  </tr>
   <tr>
  <td>
    	收货地址：<input name="address" id="address" type="text" value=""  width="200"/>(只支持本小区送货)
   </td>
  </tr>
  <tr>
   <td>
   <input type="hidden" id="chk" value="" name="chk" />
    	<input name="button" type="submit" value="提交订单" class="myButton" />
   </td>
  </tr>
  <tr>
    <td height="25" colspan="2"><%@ include file="../include/listpage.jsp"%>
    </td>
  </tr>
  <tr>
    <td height="1" colspan="2" bgcolor="#A6CAE8"></td>
  </tr>
</table>
<script src="${ctx}/js/buyProduct.js"></script>
</c:if>

<%@ include file="../include/bottom.jsp"%>